LGF_GetClockState (FB / 1.0.0)

Overview

Author: Simatic Systems Support

Short description

This function reads the local time, the system time and returns the NTP status.

Block Interface

LGF_GetClockState (FB)
   localTime  DTL
    
   systemTime  DTL
    
   isDaylightSavingTime  Bool
    
   ntpActivated  Bool
    
   error  Bool
    
   status  Word
    
   diagnostics  LGF_typeDiagnostics
    
   

Output parameter

IdentifierData type Description
localTimeDTL Local time
systemTimeDTL System time (UTC)
isDaylightSavingTimeBool Daylight saving time active
ntpActivatedBool NTP Client activated
errorBool TRUE: An error occurred during the execution of the FB
statusWord 16#0000 - 16#7FFF: Status of the FB, 16#8000 - 16#FFFF: Error identification
diagnosticsLGF_typeDiagnostics Diagnostics information of FB

Status & Error codes

Code / ValueIdentifier / Description
16#0000STATUS_FINISHED_NO_ERROR
NO error occurred in function call
16#8401ERR_NTP_SERVER_SYNC_MISSING
Error: NTP Client missing time synchronization
16#8601ERR_READ_LOCAL_TIME
Error: Read local time
16#8602ERR_READ_SYSTEM_TIME
Error: Read system time
16#8610ERR_READ_CLOCK_STATE
Error: Read clock state

User defined datatype(s)

LGF_typeDiagnostics (UDT / V1.0.1)

Diagnostic structure to store and transfer diagnostic information from blocks through the interface.

Identifier Data type Default value Description
status Word 16#0000 Status of the Block or error identification when error occurred
subfunctionStatus Word 16#0000 Status or return value of called FB's, FC's and system blocks
stateNumber DInt 0 State in the state machine of the block where the error occurred

Functional description

NOTE
If NTP time synchronization is activated in the hardware configuration, make sure that the time zone settings are correctly set to your local time zone!

Change log

Version & DateChange description
1.0.0Simatic Systems Support
06.05.2025First released version